/**    
 * @package com.liusany.myshop.service 
 * @description : TODO(用一句话描述该包做什么) 
 * @Copyright: Bmcok Corporation 2012    
*/
package com.liusany.myshop.service;

import java.io.Serializable;
import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import com.liusany.modules.orm.Page;
import com.liusany.modules.orm.PageRequest;
import com.liusany.modules.orm.PropertyFilter;
import com.liusany.modules.orm.hibernate.HibernateDao;

/**   
 * @filename ：BaseService.java   
 * @description : TODO(用一句话描述该类做什么) 
 * @version ：   V 1.0
 * @author : liusany
 * @create : 2012-5-18 上午11:33:30  
 * @Copyright: Bmcok Corporation 2012    
 * 
 * Modification History:
 * 	Date			Author			Version			Description
 *--------------------------------------------------------------
 *2012-5-18 上午11:33:30
 */
@Transactional
public class BaseService<T,PK extends Serializable> {
	
	private HibernateDao<T, PK> baseDao;

	public HibernateDao<T, PK> getBaseDao() {
		return baseDao;
	}
	
	public void setBaseDao(HibernateDao<T, PK> baseDao) {
		this.baseDao = baseDao;
	}
	
	public T get(final PK id){
		
		return baseDao.get(id);
	}
	
	/**
	 * 获取所有list
	 */
	public List<T> getAll(){
		return baseDao.getAll();
	}
	
	/**
	 * 分页查询
	 * @author:liusany
	 * @param pageRequest
	 * @param filters
	 * @return
	 */
	public Page<T> findByPage(final PageRequest pageRequest, final List<PropertyFilter> filters){
		return baseDao.findPage(pageRequest, filters);
	}
}
